package cool.taomu.toolkit.druid

import com.google.inject.Key
import cool.taomu.toolkit.Context
import cool.taomu.toolkit.TaomuConfigure
import cool.taomu.toolkit.TaomuGuice
import cool.taomu.toolkit.TaomuGuiceServiceLoader
import cool.taomu.toolkit.annotations.datasource.Primary
import cool.taomu.toolkit.crypto.Base64
import javax.sql.DataSource
import org.junit.jupiter.api.Test

class DruidTest {
    @Test
    def void a() {
        val TaomuConfigure config = new TaomuConfigure(new Base64())
        config.loadConfig
        var injector = TaomuGuice.createInjector(config)
        TaomuGuiceServiceLoader.loadIPlatform(injector, config)
        var context = injector.getInstance(Context);
        var test = context.supplierInjector.get().getInstance(Key.get(DataSource,Primary))
        test.connection.close
    }
}
